package controller

import (
	"github.com/gin-gonic/gin"
	"github.com/lostvip-com/lv_framework/lv_global"
	"log"
	"main/internal/remini/service"
)

type ReminiController struct{}

type Prompt struct {
	Message string `json:"message"`
}

func (w ReminiController) Chat(c *gin.Context) {
	var prompt Prompt
	if err := c.BindJSON(&prompt); err != nil {
		log.Fatalf("Error binding JSON: %v", err)
	}
	proxyUrl := lv_global.Config().GetProxyUrl()
	content := service.ChatAndProofread(prompt.Message, proxyUrl)
	c.JSON(200, gin.H{
		"message": content,
	})
}

func (w ReminiController) Ping(c *gin.Context) {
	c.JSON(200, gin.H{
		"message": "pong",
	})
}
